//
//  NSDictionary+Utils.m
//  Maylida
//
//  Created by Laojingxing on 2018/4/13.
//  Copyright © 2018年 laojingxing. All rights reserved.
//

#import "NSDictionary+Utils.h"

@implementation NSDictionary (Utils)
/**
 *  判断字典中某个key是否存在
 *
 *  @param keyName 存在返回YES
 */
- (BOOL)isForKeyExists:(NSString*)keyName {
    if ([[self allKeys] containsObject:keyName]) {
        return YES;
    }
    return NO;
}

- (id)safeObjectForKey:(NSString*)key {
    
    id val = [self objectForKey:key];
    if ([val isEqual:[NSNull null]]) {
        
        return nil;
    }
    return val;
}
@end
